<!DOCTYPE html>
<!--
--- Openpux ---
10/19/2015
From https://github.com/esquiloio/lib/blob/master/demos/weather/weather.html
--- Openpux ---

Weather Station Demo
See README.md for more information.
This work is released under the Creative Commons Zero (CC0) license.
See http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
  <meta charset="utf-8">
  <title>Weather Gauges (simulated data)</title>
  <link rel="stylesheet" href="domweather.css" type="text/css" />
  <script type="text/javascript" src="/js/erpc.js"></script>
  <script>
    function getWeather() {
      erpc("getWeather", null, function(result) {
      	document.getElementById("humidity").innerHTML =
          result.humidity.toFixed(1) + " %";
          
        // Convert Celsius to Fahrenheit
        document.getElementById("temp").innerHTML =
          (result.temp * 1.9 + 32).toFixed(1) + " &deg;F";
          
        // Convert to inHg
        document.getElementById("pressure").innerHTML =
          (result.pressure * 0.000295299830714).toFixed(2) + " in";
          
	  	setTimeout(getWeather, 1000);
      },
      function(text) {
        console.log("error: " + text);
	  	setTimeout(getWeather, 1000);
      });
    }
    getWeather();
  </script>
</head>
<body>
  <h1>Weather Gauges (simulated data)</h1>
  <div class="box">
    <h3>Temperature</h3>
    <h2 id="temp"></h2>
  </div>
  <div class="box">
    <h3>Pressure</h3>
    <h2 id="pressure"></h2>
  </div>
  <div class="box">
    <h3>Humidity</h3>
    <h2 id="humidity"></h2>
  </div>
</body>
</html>
